package com.shop.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.pojo.wms.Wms_Ware_Info;
import com.shop.pojo.wms.Wms_Ware_Sku;
import com.shop.service.Wms_Ware_Sku_Service;
import com.shop.utils.LayuiUtils;
import com.shop.utils.R;
import jdk.nashorn.internal.ir.ReturnNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 商品库存-李贝贝
 */
@RestController
@RequestMapping("/ware_sku")
public class Wms_Ware_Sku_Controller {

    @Autowired
    private Wms_Ware_Sku_Service wms_ware_sku_service;

    /**
     * 显示所有商品库存
     * @param page
     * @param limit
     * @param wms_ware_sku
     * @return
     */
    @GetMapping("/find_All_Ware_Sku")
    public LayuiUtils<Wms_Ware_Sku> find_All_Ware_Sku(Integer page,Integer limit,Wms_Ware_Sku wms_ware_sku){
        Page<Wms_Ware_Sku> pages = new Page<>(page,limit);
        return wms_ware_sku_service.find_Wms_Ware_Sku(pages,wms_ware_sku);
    }

    /**
     * 添加
     * @param wms_ware_sku
     * @return
     */
    @PostMapping("/insert_Ware_Sku")
    public R insert_Ware_Sku(@RequestBody Wms_Ware_Sku wms_ware_sku){
        return wms_ware_sku_service.insert_ware_sku(wms_ware_sku);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @DeleteMapping("/delete_Ware_Sku")
    public R delete_Ware_Sku(@RequestParam List<Long> id){
        return wms_ware_sku_service.delete_ware_sku(id);
    }

    /**
     * 修改
     * @param wms_ware_sku
     * @return
     */
    @PutMapping("/update_Ware_Sku")
    public R update_Ware_Sku(@RequestBody Wms_Ware_Sku wms_ware_sku){
        return wms_ware_sku_service.update_ware_sku(wms_ware_sku);
    }

    /**
     * 后台查询下拉框所有的仓库显示页面
     */
    @GetMapping("/find_admin_ware_info_All")
    public List<Wms_Ware_Info>  find_admin_ware_info_All(){
        return wms_ware_sku_service.find_admin_ware_info_All();
    }

}
